﻿<?php
require_once('conn.php');
	
	$id_buyRecord=$_GET['id'];
	$mobileNO=$_GET['no'];
	$name=$_GET['na'];
	$sex=$_GET['sx'];
	
	$url_header_dd="http://wt.chinaweimei.com.cn/apihttp/SMSSend.aspx?user=%B6%A5%B5%E7%D1%DB%BE%B5%D0%D0&pass=734yvu";
	$url_header_xz="http://wt.chinaweimei.com.cn/apihttp/SMSSend.aspx?user=%C9%EE%DB%DA%D6%EC%CE%B0%C9%FA&pass=weisheng";		
	
	$msg="【取镜提醒】".$name.$sex."，您在S-OPTA定做的眼镜已经可以取镜，取镜时间：中午12点到晚10点。电话23601932";
	$msg=mb_convert_encoding($msg, 'gb2312' ,'utf-8');
	$url=$url_header_dd."&context=".$msg."&mobile=".$mobileNO;
	//$url = "http://wt.chinaweimei.com.cn/apihttp/SMSSend.aspx?user=%C9%EE%DB%DA%D6%EC%CE%B0%C9%FA&pass=weisheng&context=$msg&mobile=$mobileNO";
	$result = file_get_contents($url);
	if($result==1)
	{
		// 跟新数据库提醒次数
		$exec_inc = "UPDATE takingRecord SET reminderTimes = reminderTimes+1 WHERE id_buyRecord = '".$id_buyRecord."'";
		mysql_query($exec_inc);
		echo '<script language="JavaScript">window.alert("提醒发送成功");</script>'; 
		echo '<script language="JavaScript">window.location.href="takingReminder.php";</script>'; 
	}
	else
	{
		echo '<script language="JavaScript">window.alert("提醒发送失败");</script>'; 
		echo '<script language="JavaScript">window.location.href="takingReminder.php";</script>'; 	
	}	
?>